//
//  Ugc_Friends_OnePicCell_WX.m
//  ZITHER
//
//  Created by weixin on 2018/9/17.
//  Copyright © 2018年 weixn. All rights reserved.
//

#import "Ugc_Friends_OnePicCell_WX.h"
#import "UgcMain_VC_WX.h"
#import "Ugc_HomePage_VC_V3.h"
//#import "sdwebimage"
#import "TopicDetailViewController.h"

@implementation Ugc_Friends_OnePicCell_WX

- (void)awakeFromNib {
    [super awakeFromNib];
    [self setUI];
    [self setMasonry];
    self.userInteractionEnabled = YES;
}

-(void)setModelSub:(CoverCreateListModelSub *)modelSub{
    _modelSub = modelSub;
    UgcMainListModel *model = [[UgcMainListModel alloc]init];
    model.avatar = modelSub.avatar;
    model.nickName = modelSub.nickName;
    model.createTime = modelSub.createTime;
    model.laudStatus = modelSub.laudStatus;
    model.laudCount = modelSub.laudCount;
    model.commentCount = modelSub.commentCount;
    model.ugcContent = modelSub.ugcContent;
    model.userId = modelSub.userId;
    model.fileList = modelSub.ugcFileList;
    model.ugcId = modelSub.relId;
    model.userSubjectTitle = modelSub.userSubjectTitle;

    self.model = model;
}


-(void)setModel:(UgcMainListModel *)model{
    
    _model = model;
    NSString *str = [NSString stringWithFormat:@"%@%@",RootUrlImage,model.avatar];
    //加载图片
    NSLog(@"加载图片宽和高");
    [self.userImage sd_setImageWithURL:[NSURL URLWithString:str] placeholderImage:[UIImage imageNamed:@"ucg_img_loding"]];
    
    
    
    self.userName.text = model.nickName;
    self.time.text = [model.createTime convertCurrentTime];
//    self.like.selected = ![model.laudStatus isEqualToString:@"0"];
    
    [self changeLike:![model.laudStatus isEqualToString:@"0"]];
//    if (![model.laudStatus isEqualToString:@"0"]) {
//        self.like.titleLabel.textColor = baseColorTheme;
//    }else{
//        self.like.titleLabel.textColor = [UIColor colorWithHex:@"999999"];
//    }
    
//        [self.like setTitle:@" 12" forState:UIControlStateNormal];
    [self.like setTitle:[NSString stringWithFormat:@" %@",model.laudCount] forState:UIControlStateNormal];
    
    
    [self.comment setTitle:[NSString stringWithFormat:@" %@",model.commentCount] forState:UIControlStateNormal];
    self.usercomment.text = model.ugcContent;
    
//    if ([self.model.userId isEqualToString:kUSER_INFO_MANAGER.userId]) {
//        self.userDelete.hidden = NO;
//    }else{
//        self.userDelete.hidden = YES;
//    }
    
//    NSString *pic = [NSString stringWithFormat:@"%@%@/zip",RootUrlImage,self.model.fileList.firstObject];

//    [self.PicView sd_setImageWithURL:[NSURL URLWithString:pic] placeholderImage:[UIImage imageNamed:@"ucg_img_loding"]];
    [self setPic];
    @weakify(self);

    if (model.userSubjectTitle.length>0 ) {
        self.TopicLab.text = [NSString stringWithFormat:@"    %@",model.userSubjectTitle];
        self.TopicIcon.hidden = NO;
        [self.TopicLab mas_updateConstraints:^(MASConstraintMaker *make) {
            @strongify(self);
            make.top.equalTo(self.userName.mas_bottom).offset(10);

        }];
    }else{
        self.TopicIcon.hidden = YES;
        self.TopicLab.text = @"";
        [self.TopicLab mas_updateConstraints:^(MASConstraintMaker *make) {
            @strongify(self);

                make.top.equalTo(self.userName.mas_bottom).offset(0);
            
            
        }];
    }  
    
    [self layoutIfNeeded];

}

//单张图 大小+缓存
-(void)setPic{
    @weakify(self);
    NSString *pic = [NSString stringWithFormat:@"%@%@",RootUrlImage,self.model.fileList.firstObject];
    
    NSString *picH = [NSString stringWithFormat:@"%@H",pic];
    NSString *picW = [NSString stringWithFormat:@"%@W",pic];
    
    if (![[NSUserDefaults standardUserDefaults] objectForKey:picH]) {
        [self.PicView sd_setImageWithURL:[NSURL URLWithString:pic] placeholderImage:[UIImage imageNamed:@""] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
            CGSize MaxSize = CGSizeMake(kScreenW-90,(kScreenW-90)/3.0*2);
//            UIImage *imgaeSize = [UIImage imageCompressFitSizeScale:image targetSize:MaxSize];
            
            CGSize Size = [UIImage getSingleSize:image.size MaxH:MaxSize.height MaxW:MaxSize.width url:pic];
            NSLog(@"%@",NSStringFromCGSize(Size));
            @weakify(self);
            [self.PicView mas_updateConstraints:^(MASConstraintMaker *make) {
                @strongify(self);

                make.height.mas_equalTo(Size.height);
                make.width.mas_equalTo(Size.width);
            }];
            [self.userPic mas_updateConstraints:^(MASConstraintMaker *make) {
                @strongify(self);

                make.height.mas_equalTo(Size.height);
                make.width.mas_equalTo(Size.width);
            }];
            [self layoutIfNeeded];
//            [[NSUserDefaults standardUserDefaults] setObject:@(Size.height) forKey:picH];
//            [[NSUserDefaults standardUserDefaults] setObject:@(Size.width) forKey:picW];
        }];
        
    }else{
        
        NSString * strW = [[NSUserDefaults standardUserDefaults] objectForKey:picW];
        NSString * strH = [[NSUserDefaults standardUserDefaults] objectForKey:picH];
        CGFloat fW = [strW floatValue];
        CGFloat fH = [strH floatValue];

        CGSize Size = CGSizeMake(fW,fH);
        [self.PicView mas_updateConstraints:^(MASConstraintMaker *make) {
            
            make.height.mas_equalTo(Size.height);
            make.width.mas_equalTo(Size.width);

        }];
        [self.userPic mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(Size.height);
            make.width.mas_equalTo(Size.width);
        }];
        
        [self.PicView sd_setImageWithURL:[NSURL URLWithString:pic] placeholderImage:[UIImage imageNamed:@"ucg_img_loding"]];
    }
  
}


-(void)setMasonry{
    @weakify(self);
    self.userImage.backgroundColor = [UIColor randomColor];
    [self.userImage mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.top.equalTo(self).offset(10);
        make.left.equalTo(self).offset(20);
        make.width.height.mas_equalTo(40);

    }];
    
    //    self.userName.backgroundColor = [UIColor randomColor];
    [self.userName mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.top.equalTo(self).offset(10);
        make.left.equalTo(self.userImage.mas_right).offset(10);
        make.height.mas_equalTo(15);
    }];
    
    //    self.time.backgroundColor = [UIColor randomColor];
    [self.time mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.centerY.equalTo(self.userName.mas_centerY).offset(0);
        make.left.equalTo(self.userName.mas_right).offset(10);
        make.height.mas_equalTo(13);
    }];
    
    //    self.usercomment.backgroundColor = [UIColor randomColor];
    [self.usercomment mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.top.equalTo(self.TopicLab.mas_bottom).offset(8);
        make.left.equalTo(self.userImage.mas_right).offset(10);
        make.right.equalTo(self.mas_right).offset(-20);

        //        make.width.height.mas_equalTo(100);
        //        make.bottom.equalTo(self).offset(-10);
    }];
    
    
    //    self.userPic.backgroundColor = [UIColor redColor];
    
    [self.userPic mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.top.equalTo(self.usercomment.mas_bottom).offset(10);
        make.left.equalTo(self.userImage.mas_right).offset(10);
//        make.right.equalTo(self.mas_right).offset(-20);
        make.height.mas_equalTo((kScreenW-90)/3.0*2);
        make.width.mas_equalTo(kScreenW-90);
//        make.bottom.equalTo(self).offset(-40);

    }];
    
    [self.PicView mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.top.equalTo(self.usercomment.mas_bottom).offset(10);
        make.left.equalTo(self.userImage.mas_right).offset(10);
//        make.right.equalTo(self.mas_right).offset(-20);
        make.height.mas_equalTo((kScreenW-90)/3.0*2);
        make.width.mas_equalTo(kScreenW-90);

    }];

    //    self.like.backgroundColor = [UIColor randomColor];
    [self.like mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.top.equalTo(self.userPic.mas_bottom).offset(12);
        make.left.equalTo(self.userPic).offset(0);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(20);
        make.bottom.equalTo(self).offset(-38);
    }];

    //    self.comment.backgroundColor = [UIColor randomColor];
    [self.comment mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.centerY.equalTo(self.like.mas_centerY).offset(0);
        make.left.equalTo(self.like.mas_right).offset(0);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(20);
    }];

    [self.userDelete mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.top.equalTo(self.userPic.mas_bottom).offset(10);
        make.left.equalTo(self.like.mas_right).offset(10);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(20);
    }];
    
    [self.TopicLab mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.top.equalTo(self.userName.mas_bottom).offset(10);
        make.left.equalTo(self.userImage.mas_right).offset(10);
        make.right.equalTo(self.mas_right).offset(-20);
    }];
    
    [self.TopicIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.top.equalTo(self.TopicLab.mas_top).offset(5);
        make.left.equalTo(self.TopicLab.mas_left).offset(0);
        make.size.mas_equalTo(CGSizeMake(10, 13));
    }];

}

/**
 userImage;
 userName;
 time;
 
 like;//点赞
 
 comment;//评论
 
 //选有
 usercomment;//用户发布评论
 userPic;//用户发布图片
 */


-(void)setUI{
    [self addSubview:self.userImage];
    [self addSubview:self.userName];
    [self addSubview:self.time];
    [self addSubview:self.like];
    [self addSubview:self.comment];
    [self addSubview:self.usercomment];
    [self addSubview:self.userPic];
    [self addSubview:self.userDelete];
    [self addSubview:self.TopicLab];
    [self addSubview:self.TopicIcon];
    [self.userPic addSubview:self.PicView];
}

-(UIImageView *)userImage{
    if (!_userImage) {
        _userImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        [_userImage setCornerRadiusWithRadius:20 isMasks:YES];
//        _userImage.contentMode = 2;
        _userImage.contentMode = UIViewContentModeScaleAspectFill;
        _userImage.contentScaleFactor = [[UIScreen mainScreen] scale];
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init];
        [[tap rac_gestureSignal] subscribeNext:^(__kindof UIGestureRecognizer * _Nullable x) {
            Ugc_HomePage_VC_V3 *vc = [[Ugc_HomePage_VC_V3 alloc]init];
            vc.userName = self.model.nickName;
            vc.userId = self.model.userId;
            vc.userAvatar =  self.model.avatar;
            [self.getNav pushViewController:vc animated:YES];
        }];

        [_userImage addGestureRecognizer:tap];
        _userImage.userInteractionEnabled = YES;
    }
    return _userImage;
}

-(QMUILabel *)userName{
    if (!_userName) {
        _userName = [[QMUILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _userName.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:13];

        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init];
        [[tap rac_gestureSignal] subscribeNext:^(__kindof UIGestureRecognizer * _Nullable x) {
            Ugc_HomePage_VC_V3 *vc = [[Ugc_HomePage_VC_V3 alloc]init];
            vc.userName = self.model.nickName;
            vc.userId = self.model.userId;
            vc.userAvatar =  self.model.avatar;
            [self.getNav pushViewController:vc animated:YES];
        }];
        [_userName addGestureRecognizer:tap];
        _userName.userInteractionEnabled = YES;
    }
    return _userName;
}

-(QMUILabel *)time{
    if (!_time) {
        _time = [[QMUILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _time.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:12];
        _time.textColor = baseColorMedium;
    }
    return _time;
}

-(QMUIButton *)like{
    if (!_like) {
        
        _like = [[QMUIButton alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        [_like setImage:[UIImage imageNamed:@"Home_SegCtrl_tracking_active"] forState:UIControlStateNormal];
        [_like setImage:[UIImage imageNamed:@"Home_SegCtrl_tracking_active_p"] forState:UIControlStateSelected];
        [_like setTitleColor:baseColorTheme forState:UIControlStateSelected];
        [_like setTitleColor:[UIColor colorWithHex:@"999999"] forState:UIControlStateNormal];
        _like.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;// 水平左对齐
        _like.titleLabel.font = [UIFont fontWithName:@"PingFangSC-Medium" size:12];
        __weak __typeof(self)weakSelf = self;
         @weakify(self);
        [[_like rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self);
            if (!weakSelf.like.selected) {
                [[serviceDefualt loadUpdateUserLaud:self.model.ugcId laudType:@"1" reponseObjctClass:nil]subscribeNext:^(ResponseData * x) {
                    if (x.success) {
                        [Tools showTips:@"点赞成功"];
                        self.model.laudStatus = @"1";
                        self.model.laudCount =  [NSString stringWithFormat:@" %ld",[self.model.laudCount integerValue]+1];
                        [self.like setTitle:self.model.laudCount forState:UIControlStateNormal];
                        [self changeLike:YES];
                    }else{
                        if (![x.errorInfo isEqualToString:@"未登录"]) {
                            [Tools showTips:x.errorInfo];
                        }else{
//                            [Tools pushSinge];
                        }
                        self.model.laudStatus = @"0";
                        [self changeLike:NO];
                    }
                }];
            } else {
                @weakify(self);
                [[serviceDefualt loadUpdateUserLaud:self.model.ugcId laudType:@"2" reponseObjctClass:nil]subscribeNext:^(ResponseData * x) {
                    @strongify(self);
                    if (x.success) {
                        [Tools showTips:@"取消成功"];
                        self.model.laudStatus = @"0";
                        self.model.laudCount =  [NSString stringWithFormat:@" %d",[self.model.laudCount integerValue]-1];
                        [self.like setTitle:self.model.laudCount forState:UIControlStateNormal];
                        [self changeLike:NO];
                    }else{
                        if (![x.errorInfo isEqualToString:@"未登录"]) {
                            [Tools showTips:x.errorInfo];
                        }else{
//                            [Tools pushSinge];
                        }
                        self.model.laudStatus = @"1";
                        [self changeLike:YES];
                    }
                }];
            }
            weakSelf.like.selected = !weakSelf.like.selected;
            
        }];
    }
    return _like;
}

-(void)changeLike:(BOOL)type{
    
    if (type) {
        self.like.selected = YES;
    }else{
        self.like.selected = NO;
    }
}
-(QMUIButton *)comment{
    if (!_comment) {
        _comment = [[QMUIButton alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        [_comment setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_comment setImage:[UIImage imageNamed:@"ucg_btn_comment"] forState:UIControlStateNormal];
//        _comment.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:12];
        _comment.titleLabel.font = [UIFont fontWithName:@"PingFangSC-Medium" size:12];
        [_comment setTitleColor:baseColorTheme forState:UIControlStateSelected];
        [_comment setTitleColor:[UIColor colorWithHex:@"999999"] forState:UIControlStateNormal];
        _comment.userInteractionEnabled = NO;
    }
    return _comment;
}

-(QMUIButton *)userDelete{
    if (!_userDelete) {
        _userDelete = [[QMUIButton alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        [_userDelete setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
        _userDelete.titleLabel.font = [UIFont systemFontOfSize:12];
        [_userDelete setTitle:@"删除" forState:UIControlStateNormal];
        _userDelete.hidden = YES;
        @weakify(self);
        [[_userDelete rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self);
            [[serviceDefualt loaddelUserUgcUgcId:self.model.ugcId reponseObjctClass:nil]subscribeNext:^(ResponseData * x) {
                if (x.success) {
                    UgcMain_VC_WX *vc = (UgcMain_VC_WX*)[self getViewController:[UgcMain_VC_WX class]];
                    [vc.scroView.tbv1.mj_header beginRefreshing];
                    [vc.scroView.tbv2.mj_header beginRefreshing];
                    
                    Ugc_HomePage_VC_V3 *vc1 = (Ugc_HomePage_VC_V3*)[self getViewController:[Ugc_HomePage_VC_V3 class]];
                    [vc1.tbv.mj_header beginRefreshing];
                    [Tools showTips:@"删除成功"];
                }else{
                    [Tools showTips:x.errorInfo];
                }
            }];
            
        }];
    }
    return _userDelete;
}

-(QMUILabel *)usercomment{
    if (!_usercomment) {
        _usercomment = [[QMUILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _usercomment.numberOfLines = 0;
        _usercomment.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:14];
        _usercomment.textColor = HexColor(0x333333);
    }
    return _usercomment;
}

-(UIView *)userPic{
    if (!_userPic) {
        _userPic = [[QMUILabel alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
        _userPic.userInteractionEnabled = YES;
    }
    return _userPic;
}

-(UIImageView *)PicView{
    if (!_PicView) {
        _PicView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
//        [_PicView setCornerRadiusWithRadius:1 isMasks:YES];
    
        _PicView.clipsToBounds = YES;
        _PicView.contentMode = 0;
        _PicView.tag = 100;
//        _PicView.backgroundColor = [UIColor redColor];
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init];
        [[tap rac_gestureSignal] subscribeNext:^(__kindof UIGestureRecognizer * _Nullable x) {
            [self showBigImage:100];
        }];
        [_PicView addGestureRecognizer:tap];
        _PicView.userInteractionEnabled = YES;
    }
    return _PicView;
}

-(void)showBigImage:(NSInteger)selectIndex{
    UIImageView *imageV = [self.userPic viewWithTag:selectIndex];
    // self.model.fileList[selectIndex-100];
    
    if (!self.imagePreviewViewController) {
        self.imagePreviewViewController = [[QMUIImagePreviewViewController alloc] init];
        self.imagePreviewViewController.imagePreviewView.delegate = self;
        
        // QMUIImagePreviewViewController 对于以 window 的方式展示的情况，默认会开启手势拖拽退出预览功能。
        // 如果使用了手势拖拽，并且退出预览时需要飞到某个 rect，则需要实现这个 block，在里面自己去 exit，如果不实现这个 block，退出动画会使用 fadeOut 那种
        
    }
    __weak __typeof(self)weakSelf = self;
    self.imagePreviewViewController.customGestureExitBlock = ^(QMUIImagePreviewViewController *aImagePreviewViewController, QMUIZoomImageView *currentZoomImageView) {
        NSInteger index = aImagePreviewViewController.imagePreviewView.currentImageIndex;
        UIImageView *imageV1 = [weakSelf.userPic viewWithTag:index+100];
        
        //        imageV.image = currentZoomImageView.image;
        //            [weakSelf.imageButton setImage:currentZoomImageView.image forState:UIControlStateNormal];
        
        [aImagePreviewViewController exitPreviewToRectInScreenCoordinate:[imageV1 convertRect:imageV1.frame toView:nil]];
        
    };
    self.imagePreviewViewController.imagePreviewView.currentImageIndex =  selectIndex-100;// 默认查看的图片的 index
    
    [self.imagePreviewViewController startPreviewFromRectInScreenCoordinate:[imageV convertRect:imageV.frame toView:nil] cornerRadius:imageV.layer.cornerRadius];
}


#pragma mark - <QMUIImagePreviewViewDelegate>

- (NSUInteger)numberOfImagesInImagePreviewView:(QMUIImagePreviewView *)imagePreviewView {
    return self.model.fileList.count;
}

- (void)imagePreviewView:(QMUIImagePreviewView *)imagePreviewView renderZoomImageView:(QMUIZoomImageView *)zoomImageView atIndex:(NSUInteger)index {
    
    // 模拟异步加载的情况
    zoomImageView.reusedIdentifier = @(index);
    [zoomImageView showLoading];
    NSString *pic = [NSString stringWithFormat:@"%@%@",RootUrlImage,self.model.fileList.firstObject];
    UIImageView *imageV = [[UIImageView alloc]init];
    
    [imageV sd_setImageWithURL:[NSURL URLWithString:pic] placeholderImage:[UIImage imageNamed:@"ucg_img_loding"] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
        if ([zoomImageView.reusedIdentifier isEqual:@(index)]) {
            [zoomImageView hideEmptyView];
            zoomImageView.image = imageV.image;
        }
    }];
    
//    [imageV sd_setImageWithURL:[NSURL URLWithString:pic] placeholderImage:[UIImage imageNamed:@"ucg_img_loding"]];
//        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//            if ([zoomImageView.reusedIdentifier isEqual:@(index)]) {
//                [zoomImageView hideEmptyView];
//                zoomImageView.image = imageV.image;
//            }
//        });
}

- (QMUIImagePreviewMediaType)imagePreviewView:(QMUIImagePreviewView *)imagePreviewView assetTypeAtIndex:(NSUInteger)index {
    return QMUIImagePreviewMediaTypeImage;
}

#pragma mark - <QMUIZoomImageViewDelegate>

- (void)singleTouchInZoomingImageView:(QMUIZoomImageView *)zoomImageView location:(CGPoint)location {
    //点击缩回
    self.imagePreviewViewController.customGestureExitBlock(self.imagePreviewViewController, zoomImageView);
}

-(BaseLab *)TopicLab{
    if (!_TopicLab) {
        _TopicLab = [BaseLab initCustomLab:@"     1232131" color:HexColor(0x333333) font:[UIFont fontWithName:@"PingFangSC-Semibold" size:15]];
        _TopicLab.numberOfLines = 2;
        _TopicLab.lineBreakMode = NSLineBreakByCharWrapping;
        [[_TopicLab addTag]subscribeNext:^(id  _Nullable x) {
            TopicDetailViewController * vc = [[TopicDetailViewController
                                               alloc]init];
            vc.topicId = self.model.userSubjectId;
            [self.getNav pushViewController:vc animated:YES];
        }];
    }
    return _TopicLab;
}

-(BaseImageV *)TopicIcon{
    if (!_TopicIcon) {
        _TopicIcon = [[BaseImageV alloc]init];
        
        _TopicIcon.image = [UIImage imageNamed:@"发布_#话题"];
        _TopicIcon.backgroundColor = [UIColor clearColor];
    }
    return _TopicIcon;
}


@end
